package dbsync4j.mapper.concrete.diff;

import dbsync4j.core.behavior.DatabaseObject;
import dbsync4j.mapper.behavior.diff.Difference;
import dbsync4j.mapper.behavior.diff.DifferenceType;

public class NullPointerDifference extends AbstractDifference implements Difference {
	
	public NullPointerDifference(DatabaseObject source, DatabaseObject destiny, String tag) {
		super(source, destiny, tag);
	}

	/* (non-Javadoc)
	 * @see dbsync4j.mapper.behavior.diff.Difference#getDifference()
	 */
	@Override
	public String getDifference() {

		String message = "";
		
		if(this.source == null) {
			message = this.rb.getString("nopair") + " " + this.destiny.getName() + ".";
		} else if (this.destiny == null) {
			message = this.rb.getString("nopair") + " " +  this.source.getName() + ".";
		}
		
		this.difference = message;
		
		return message;
	}

	/* (non-Javadoc)
	 * @see dbsync4j.mapper.behavior.diff.Difference#getDifferenceType()
	 */
	@Override
	public DifferenceType getDifferenceType() {
		
		return null;
	}

	/* (non-Javadoc)
	 * @see dbsync4j.mapper.behavior.diff.Difference#getDestinyValue()
	 */
	@Override
	public String getDestinyValue() {

		return (this.destiny == null) ? this.rb.getString("null") : this.rb.getString("notNull");
	}

	/* (non-Javadoc)
	 * @see dbsync4j.mapper.behavior.diff.Difference#getSourceValue()
	 */
	@Override
	public String getSourceValue() {
		
		return (this.source == null) ? this.rb.getString("null") : this.rb.getString("notNull");
	}

	/* (non-Javadoc)
	 * @see dbsync4j.mapper.concrete.diff.AbstractDifference#toString()
	 */
	@Override
	public String toString() {

		return super.toString();
	}
	
}
